//
//  HKSentry.m
//  YNDemo
//
//  Created by 胡锦涛 on 2020/11/19.
//

#import "HKSentry.h"
#import <Sentry/Sentry.h>

@implementation HKSentry
+ (void)captureMessage:(NSString *)message{
    [SentrySDK captureMessage:message];
}
+ (void)captureEventWithErrorMessage:(NSString *)errMsg withParams:(NSDictionary*)params{
    SentryEvent *event = [[SentryEvent alloc] initWithLevel:kSentryLevelDebug];
    [event setLevel:kSentryLevelError];
    SentryMessage * message = [[SentryMessage alloc] initWithFormatted:errMsg];
    event.message = message;
    event.extra = params; //请求参数
    [SentrySDK captureEvent:event];
}
+ (void)captureException:(NSException *)exception withWithUserId:(NSString *)userId withExtra:(NSDictionary *)extra{
    SentryScope * scope = [[SentryScope alloc] init];
    [scope setExtras:extra];
    NSString * UserId = @"YUNNIAO";
    if (userId) {
        UserId = userId;
    }
    SentryUser * user = [[SentryUser alloc] initWithUserId:UserId];
    user.username = [UIDevice currentDevice].name;
    [scope setUser:user];
    [SentrySDK captureException:exception withScope:scope];
}
@end
